package com.wly.adapter
{
	import com.wly.adapter.common.AdapterBase;
	import com.wly.ui.ItemGrid;
	import com.wly.ui.ToolBar;
	
	import flash.display.BitmapData;
	
	public class ToolbarAdapter extends AdapterBase
	{
		private var _itemGridAdapter:ItemGridAdapter;
		
		public function ToolbarAdapter()
		{
			super();
			_itemGridAdapter = new ItemGridAdapter;
			_itemGridAdapter.parentAdapter = this;
		}
		
		public function get uiToolbar():ToolBar
		{
			return ui as ToolBar;
		}
		
		override protected function onUIAttach():void
		{
			super.onUIAttach();
			
			if(uiToolbar)
			{
				uiToolbar.updateItemGridAdapter(_itemGridAdapter);
			}
		}
		
		public function onPreItem():void
		{
			_itemGridAdapter.onPreItem();
		}
		
		public function onPrePage():void
		{
			_itemGridAdapter.onPrePage();
		}
		
		public function onNextItem():void
		{
			_itemGridAdapter.onNextItem();
		}
		
		public function onNextPage():void
		{
			_itemGridAdapter.onNextPage();
		}
		
		public function onItemSelect(bmd:BitmapData):void
		{
			MapEditerMainAdapter.CURBMD = bmd;
		}
		
		public function updateData(bmdArr:Array):void
		{
			_itemGridAdapter.updateData(bmdArr);
		}
	}
}